package com.java.Enum;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author: ZhangJin
 * @Date: 2020/9/5 17:32
 */
@Slf4j
public enum CurrentState {

    STATE1("1","经营中"),
    STATE2("2","空置中"),
    NoSTATE("3","客户没要求");

    private String Type;
    private String Explain;

    CurrentState(String type, String explain) {
        Type = type;
        Explain = explain;
    }

    public String getType() {
        return Type;
    }

    public String getExplain() {
        return Explain;
    }

    public static CurrentState getState(String explain) {
        if (explain == null || explain.equals(" ")){
            return NoSTATE;
        }
        if (explain.equals(STATE1.getExplain()))
            return STATE1;
        if (explain.equals(STATE2.getExplain()))
            return STATE2;
        return NoSTATE;
    }

    public static CurrentState getStateByType(String type) {
        if (type.equals(STATE1.getType()))
            return STATE1;
        if (type.equals(STATE2.getType()))
            return STATE2;
        return NoSTATE;
    }



}
